//
//  SignUpSexViewController.swift
//  FridgeSolo
//
//  Created by LiuXing on 2017/6/10.
//  Copyright © 2017年 kumi.com. All rights reserved.
//

import UIKit

class SignUpStep3ViewController: UIViewController {
    
    
    @IBOutlet weak var segControl: UISegmentedControl!
    @IBOutlet weak var view1: UIView!
    @IBOutlet weak var label1: UILabel!
    @IBOutlet weak var label2: UILabel!
    
    @IBOutlet weak var view2: UIView!
    @IBOutlet weak var label3: UILabel!
    
    var first: Bool = true

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        title = "YOU"
        navigationItem.rightBarButtonItem =  nextButtonItem
        
        segControl.tintColor = DefaultColor
//        view1.addGestureRecognizer(tap1)
//        view2.addGestureRecognizer(tap2)
    }
    
    @IBAction func birthdayButtonClick(_ sender: Any) {
        XFPickerView.showDatePicker("birthday choose") {( selectedDate) in
            let formatter = DateFormatter()
            formatter.dateFormat = "dd-mm-yyyy"
            let dateString = formatter.string(from: selectedDate)
//            print(dateString)
            let btn = sender as! UIButton
            btn.setTitle(dateString, for: .normal)
        }
    }
    
    
    private lazy var tap1: UITapGestureRecognizer = {
        let tap = UITapGestureRecognizer.init(target: self, action: #selector(tapAction1))
        return tap
    }()
    
    func tapAction1() {
        first = true
        view1.backgroundColor = DefaultColor
        label1.textColor = UIColor.white
        label2.textColor = UIColor.white
        label3.textColor = UIColor.lightGray
        view2.backgroundColor = UIColor.white
    }
    
    private lazy var tap2: UITapGestureRecognizer = {
        let tap = UITapGestureRecognizer.init(target: self, action: #selector(tapAction2))
        return tap
    }()
    
    func tapAction2() {
        first = false
        view1.backgroundColor = UIColor.white
        label1.textColor = UIColor.lightGray
        label2.textColor = UIColor.lightGray
        label3.textColor = UIColor.white
        view2.backgroundColor = DefaultColor
    }
    
    private lazy var nextButtonItem: UIBarButtonItem = {
        let nextButtonItem = UIBarButtonItem(image: UIImage(named:"next"), style: .plain, target: self, action: #selector(nextButtonItemClick))
        nextButtonItem.tintColor = UIColor.white
        return nextButtonItem
    }()
    
    @objc private func nextButtonItemClick() {
        let sb = UIStoryboard(name: "LogInAndSignUp", bundle: nil)
        let vc = sb.instantiateViewController(withIdentifier: "SignUpStep4ViewController") as! SignUpStep4ViewController
        navigationController!.pushViewController(vc, animated: true)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
